package com.example.shopdemo.enums;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-01-24
 **/
public enum HeadLineStateEnum {
    SUCCESS(1,"创建成功"),
    INNER_ERROR(-1001,"操作失败"),
    EMPTY(-1002,"头条信息为空");

    private int key;
    private String value;

    HeadLineStateEnum(int key,String value){
        this.key = key;
        this.value = value;
    }

    public int getKey(){
        return key;
    }

    public String getValue(){
        return value;
    }


    public static HeadLineStateEnum stateOf(int index){
        for(HeadLineStateEnum  state:values()){
            if(state.getKey()==index){
                return state;
            }
        }
        return null;
    }
}
